package com.tinama.jedis01.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author lgc
 * @createDate 2020/10/14 - 10:22
 */
public class Demo1 {
    public static void main(String[] args){
//        ExecutorService threadPool = Executors.newSingleThreadExecutor();
        ExecutorService threadPool = Executors.newFixedThreadPool(5);
//        ExecutorService threadPool = Executors.newCachedThreadPool();
        for (int i = 0; i < 30; i++) {
            threadPool.execute(()->{
                System.out.println(Thread.currentThread().getName()+"ok");
            });
        }

        //
        threadPool.shutdown();
    }
}
